<%@ page language="java" import="java.util.*,zhjb.platform.module.schedule.bean.*" pageEncoding="UTF-8"%>
<jsp:include page="/include/nocache.jsp"></jsp:include>
<%
	Object user=request.getSession(true).getAttribute("user");
	List<DateBlock> dataBlocks=(List<DateBlock>)request.getAttribute("dataBlocks");
	Integer year=(Integer)request.getAttribute("year");
	Integer month=(Integer)request.getAttribute("month");
	String smonth=(month+1)+"";
	if(month+1<10){
		smonth="0"+(month+1);
	}
	MDate nextYear=request.getAttribute("nextYear")!=null?(MDate)request.getAttribute("nextYear"):null;
	MDate nextMonth=request.getAttribute("nextMonth")!=null?(MDate)request.getAttribute("nextMonth"):null;
	MDate preYear=request.getAttribute("preYear")!=null?(MDate)request.getAttribute("preYear"):null;
	MDate preMonth=request.getAttribute("preMonth")!=null?(MDate)request.getAttribute("preMonth"):null;
%>
<input type="text" id="theyear" style="display:none" value="<%=year %>">
<input type="text" id="themonth" style="display:none" value="<%=month %>"> 
<table border=1 width="100%" height="50%">
	<tr>
		<td align="center">
		</td> 
		<td colspan="5" align="center">
			<font size="12">
			<a href="javascipt:;" onclick="changeDate(<%=preYear.getYear()%>,<%=preYear.getMonth()%>);return false;" style="text-decoration: none">&lt&lt</a>
			&nbsp;&nbsp;
			<a href="javascipt:;" id="preMonth" onclick="changeDate(<%=preMonth.getYear()%>,<%=preMonth.getMonth()%>);return false;" style="text-decoration: none">&lt</a>
				&nbsp;<%=year %>年<%=smonth %>月&nbsp;
			<a href="javascipt:;" id="nextMonth" onclick="changeDate(<%=nextMonth.getYear()%>,<%=nextMonth.getMonth()%>);return false;" style="text-decoration: none">&gt</a>			
			&nbsp;&nbsp;
			<a href="javascipt:;" onclick="changeDate(<%=nextYear.getYear()%>,<%=nextYear.getMonth()%>);return false;" style="text-decoration: none">&gt&gt</a>
			</font> 
		</td>
		<td align="center">
			<%//if(user!=null){%>
				<font size="12"><a href="${pageContext.request.contextPath}/schedule/toadd.zhtml">添加</a></font>				
			<%//} %>
		</td>
	</tr>
	<tr>
		<td align="center"><font size="12">周日</font></td>
		<td align="center"><font size="12">周一</font></td>
		<td align="center"><font size="12">周二</font></td>
		<td align="center"><font size="12">周三</font></td>
		<td align="center"><font size="12">周四</font></td>
		<td align="center"><font size="12">周五</font></td>
		<td align="center"><font size="12">周六</font></td>
	</tr>
	<%for(int i=0;i<42;i++){%>
		<%if(i==0){%>
			<tr>	
		<%} %>
		<td align="center" style="cursor: pointer; " onclick="viewTask(this,'time<%=i %>')"><font size="12">
			<%if(dataBlocks.get(i).getDate()!=null){%>
				<input type="text" style="display:none" id="time<%=i %>" value="<%=dataBlocks.get(i).getDate().taskIds()%>">
				<div class='<%=dataBlocks.get(i).getDate().isCurDate()?"curdate":"" %>'>
					<div style="float:right">
						<%=dataBlocks.get(i).getDate().isCurDate()?"<font color='red'>":"" %>
						<%=dataBlocks.get(i).getDate().getDate() %> 
						<%=dataBlocks.get(i).getDate().isCurDate()?"</font>":"" %>
					</div> 
					<%if(dataBlocks.get(i).getDate()!=null&&dataBlocks.get(i).getDate().getTasks().size()>0){%>
					<div style="float:left"><font size="6" color="#1E50A2">(<%=dataBlocks.get(i).getDate().getTasks().size()%>)</font></div>						
					<%} %> 
				</div> 
			<% }else{%>  
				<div>  
				&nbsp;
				</div>
			<%}%>
		</font>		
		</td>
		<%if((i+1)%7==0){%>
			</tr><tr>
		<%} %>
	<%} %>
	</tr>
</table>
<div style="font-size: 40px" id="content">

</div>
<script>
	function viewTask(td,time){
		$("td").each(function(){ 
			$(this).css("background-color","#ffffff");
		});
		$(td).css("background-color","#E2EEFC");
		$("#content").html("");
		if(document.getElementById(time)){
			var ids=$("#"+time).val();
			if($.trim(ids)!=""){
				var url="${pageContext.request.contextPath}/schedule/findTask.zhtml?taskIds="+ids+"&_rad="+new Date().getTime();
				$.get(url,function(data){
					$("#content").html(data);
				});
			}
		}
	}
</script>